<script type="text/javascript">
    $(function () {

        KindEditor.ready(function (K) {
            K.create('#content', {
                resizeType: 1,
                afterBlur: function () {
                    this.sync();
                }
            });
        });

        $.post("{:U('Category/buildTree')}", function (data) {
            $(".subMenuList").append(data);
        }, "html");

        $(".goBack").click(function(){
            var category_id = "{$Think.session.cate_id}";
            var url = "__CONTROLLER__/index";
            if(category_id!=null && category_id!=""){
                url +="/category_id/"+category_id;
            }
            url +=".html";
            location.href = url;

        });
    });

    function categorySelectChangeToTitle() {
        $("select[name='article[category_id]']").change(function () {
            var val = $(this).find("option:selected").val();
            if(val==null || val=="")return false;
            var text = $(this).find("option:selected").text();
            var title = $("input[name='article[title]']").val();
            if(text.indexOf("|--")>0){
                text = text.substring(5);
            }
            $("input[name='article[title]']").val(text);

        });
    }


</script>